package cn.edu.xmu.restfuldemo.model.VO;


import cn.edu.xmu.restfuldemo.model.BO.Goods;
import cn.edu.xmu.restfuldemo.model.BO.Product;
import cn.edu.xmu.restfuldemo.model.VoObject;
import lombok.*;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

/**
 * @author RenJieZheng
 */
@Getter
@Setter
@AllArgsConstructor
@ToString
public class GoodsRetVo implements VoObject, Serializable {
    private Long id;
    private String name;
    private Long brandId;
    private Long freightId;
    private Long shopId;
    private String goodsSn;
    private String detail;
    private String imageUrl;
    private Byte disabled;
    private LocalDateTime gmtCreate;
    private LocalDateTime gmtModified;
    private List<Product> products;

    public GoodsRetVo() {
        products = new ArrayList<>();
    }

    public GoodsRetVo(Goods goods, List<Product>list){
        this.id = goods.getId();
        this.name = goods.getName();
        this.brandId = goods.getBrandId();
        this.freightId = goods.getFreightId();
        this.shopId = goods.getShopId();
        this.goodsSn = goods.getGoodsSn();
        this.detail = goods.getDetail();
        this.imageUrl = goods.getImageUrl();
        this.disabled = goods.getDisabled();
        this.gmtCreate = goods.getGmtCreate();
        this.gmtModified = goods.getGmtModified();
        this.products = list;
    }

    @Override
    public Object createVo() {
        return this;
    }

    @Override
    public Object createSimpleVo() {
        return this;
    }



}
